from math import sqrt


class Math:
    def __init__(self):
        pass

    def add(self, *args):
        result = 0
        for i in range(len(args)):
            result += args[i]
        return result

    def subtraction(self, *args):
        result = args[0]
        for i in range(len(args)):
            if i != 0:
                result -= args[i]
        return result

    def multiplication(self, *args):
        result = args[0]
        for i in range(len(args)):
            if i != 0:
                result *= args[i]
        return result

    def division(self, *args):
        result = args[0]
        for i in range(len(args)):
            if i != 0:
                assert args[i] != 0, '被除数不能为0'
                result /= args[i]
        return result

    def power(self, *args):
        result = args[0]
        for i in range(len(args)):
            if i != 0:
                result **= args[i]
        return result

    def evolution(self, x):
        return sqrt(x)


class OperatingSystem:
    def __init__(self):
        pass

    def start(self):
        print("开启")

    def shutdown(self):
        print("关机")


class Windows(OperatingSystem):
    def __init__(self):
        super(Windows, self).__init__()
        self.name = "windows"

    def start(self):
        print("windows开机")

    def playGame(self):
        print("玩游戏")


class Mac(OperatingSystem):
    def __init__(self):
        super(Mac, self).__init__()
        self.name = "Mac"

    def start(self):
        print("Mac 开机")

    def code(self):
        print("coding...")


if __name__ == "__main__":
    math = Math()
    print(math.add(1, 2, 3))
    print(math.subtraction(10, 2, 1))
    print(math.multiplication(1, 2, 3))
    print(math.division(10, 2, 1))
    print(math.power(2, 3))
    print(math.evolution(3))
    mac = Mac()
    mac.code()
    windows = Windows()
    windows.playGame()
